home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / zpaint.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.1 KB  |  88 lines

  1. /* Copyright (C) 1997, 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: zpaint.c,v 1.2 2000/09/19 19:00:55 lpd Exp $ */
  20. /* Painting operators */
  21. #include "ghost.h"
  22. #include "oper.h"
  23. #include "gspaint.h"
  24. #include "igstate.h"
  25.  
  26. /* - fill - */
  27. private int
  28. zfill(i_ctx_t *i_ctx_p)
  29. {
  30.     return gs_fill(igs);
  31. }
  32.  
  33. /* - eofill - */
  34. private int
  35. zeofill(i_ctx_t *i_ctx_p)
  36. {
  37.     return gs_eofill(igs);
  38. }
  39.  
  40. /* - stroke - */
  41. private int
  42. zstroke(i_ctx_t *i_ctx_p)
  43. {
  44.     return gs_stroke(igs);
  45. }
  46.  
  47. /* ------ Non-standard operators ------ */
  48.  
  49. /* - .fillpage - */
  50. private int
  51. zfillpage(i_ctx_t *i_ctx_p)
  52. {
  53.     return gs_fillpage(igs);
  54. }
  55.  
  56. /* <width> <height> <data> .imagepath - */
  57. private int
  58. zimagepath(i_ctx_t *i_ctx_p)
  59. {
  60.     os_ptr op = osp;
  61.     int code;
  62.  
  63.     check_type(op[-2], t_integer);
  64.     check_type(op[-1], t_integer);
  65.     check_read_type(*op, t_string);
  66.     if (r_size(op) < ((op[-2].value.intval + 7) >> 3) * op[-1].value.intval)
  67.     return_error(e_rangecheck);
  68.     code = gs_imagepath(igs,
  69.             (int)op[-2].value.intval, (int)op[-1].value.intval,
  70.             op->value.const_bytes);
  71.     if (code >= 0)
  72.     pop(3);
  73.     return code;
  74. }
  75.  
  76. /* ------ Initialization procedure ------ */
  77.  
  78. const op_def zpaint_op_defs[] =
  79. {
  80.     {"0eofill", zeofill},
  81.     {"0fill", zfill},
  82.     {"0stroke", zstroke},
  83.         /* Non-standard operators */
  84.     {"0.fillpage", zfillpage},
  85.     {"3.imagepath", zimagepath},
  86.     op_def_end(0)
  87. };
  88.